import { http } from "@/utils/request";
import type {
  pagerListQueryType,
  pagerListQueryTypeResponse,
} from "@/interface/common.ts";
import type {
  projectRoleVo,
  projectRoleCount,
} from "@/interface/pm/projectRole.ts";

// 单项目-项目角色列表查询
export const getProjectRoleList = (
  data: pagerListQueryType,
): Promise<pagerListQueryTypeResponse<projectRoleVo>> => {
  return http.post(`/projectRole/list`, data);
};

// 添加
export const createProjectRole = (data: projectRoleVo): projectRoleVo => {
  return http.put("/projectRole/create", data);
};

// 删除
export const deleteProjectRole = (roleId: string): Promise<null> => {
  return http.delete(`/projectRole/${roleId}`);
};

// 编辑
export const editProjectRole = (data: projectRoleVo): Promise<null> => {
  return http.put(`/projectRole/edit`, data);
};

//获取详情
export const getProjectRoleDetail = (id: string): Promise<projectRoleVo> => {
  return http.get(`/projectRole/${id}`);
};

// 表头计数
export const getProjectRoleCount = (
  projectId: string,
): Promise<projectRoleCount> => {
  return http.get(`/projectRole/projectRoleTitle/${projectId}`);
};
